package com.example.statistics.ui.bank

import android.os.Bundle
import com.example.statistics.R
import com.example.statistics.bean.AdjustmentBean
import com.example.statistics.common.BaseLoadingListActivity
import com.example.statistics.ex.goTimeFormat
import com.example.statistics.net.UrlConfig
import com.example.statistics.utils.activityForResult
import com.jhj.slimadapter.SlimAdapter
import com.jhj.slimadapter.holder.ViewInjector

class AdjustmentListActivity : BaseLoadingListActivity<AdjustmentBean>() {

    override val title: String
        get() = "银行调账"

    override val url: String
        get() = UrlConfig.BANK_ADJUSTMENT_LIST

    override val itemLayoutRes: Int
        get() = R.layout.list_item_common_display

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        topBarRightImage {
            activityForResult<AdjustmentAddActivity>() {
                refresh()
            }
        }
    }

    override fun itemViewConvert(adapter: SlimAdapter, injector: ViewInjector, bean: AdjustmentBean, position: Int) {
        injector.text(R.id.tv_title, bean.money.toString())
            .text(R.id.tv_subtitle, bean.collectionAccount + " | " + bean.paymentAccount)
            .text(R.id.tv_bottom_right, bean.date.goTimeFormat() + bean.time.substring(0, 5))
    }


}